home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 April / EnigmA AMIGA RUN 06 (1996)(G.R. Edizioni)(IT)[!][issue 1996-04][Skylink CD V].iso / internet / others / spoolwatch.lha / SpoolWatch / Src / AllocIntuiText.c next >
C/C++ Source or Header  |  1995-09-23  |  2KB  |  80 lines

  1.  
  2. /*
  3.  *    Function    AllocIntuiText
  4.  *    Programmer    N.d'Alterio
  5.  *    Date        23/09/95
  6.  *
  7.  *  Synopsis:    Allocates an IntuiText structure and intialises it
  8.  *        to a standard structure passed as an argument.
  9.  *        The text string is filled with spaces for text 
  10.  *        blanking purposes.
  11.  *        The IntuiText structure may be freeded using 
  12.  *        FreeIntuiText.
  13.  *
  14.  *  Arguments:    struct IntuiText *base_it    IntuiText structure to
  15.  *                        initialise new structure with.
  16.  *
  17.  *  Returns:    struct IntuiText *        Allocated IntuiText structure.
  18.  *        NULL                If error.
  19.  *
  20.  *  Variables:     i                Loop var.
  21.  *        *it                IntuiText structure created.
  22.  * 
  23.  *  Functions:    AllocMem            Allocate memory (EXEC)
  24.  *        FreeMem                Free memory (EXEC)
  25.  *
  26.  *  $Id: AllocIntuiText.c 1.1 1995/09/23 16:43:05 daltern Exp $
  27.  *
  28.  */
  29.  
  30. #include "SpoolWatch.h"
  31.  
  32. struct IntuiText *AllocIntuiText( struct IntuiText *base_it )
  33.  
  34. {
  35.  
  36.   register int i;
  37.  
  38.   struct IntuiText *it;
  39.  
  40.   if ( it = (struct IntuiText *)AllocMem( sizeof( struct IntuiText ), MEMF_ANY | MEMF_CLEAR ) ) {
  41.  
  42. /*
  43.  *   Allocate memory for text string.
  44.  */
  45.  
  46.     if ( it->IText = (char *)AllocMem( FULLINFO_LEN * sizeof( char ), MEMF_ANY | MEMF_CLEAR ) ) {
  47.  
  48. /*
  49.  *   Intialise allocate IntuiText structure.
  50.  */
  51.  
  52.         it->FrontPen  = base_it->FrontPen;
  53.         it->BackPen   = base_it->BackPen;
  54.         it->DrawMode  = base_it->DrawMode;
  55.         it->ITextFont = base_it->ITextFont;
  56.  
  57. /*
  58.  *   Set text string to blank.
  59.  */
  60.  
  61.         for ( i = 0; i < (FULLINFO_LEN-1); i++ ) it->IText[i] = ' ';
  62.  
  63.     } else {
  64.  
  65.         FreeMem( it, sizeof( struct IntuiText ) );
  66.         it = NULL;
  67.  
  68.         }   /* end if it->IText */ 
  69.  
  70.   }   /* end if it */
  71.  
  72.   return it;
  73.  
  74. }   /* end function AllocIntuiText */
  75.  
  76.  
  77. /*========================================================================*
  78.                         END FUNCTION AllocIntuiText
  79.  *========================================================================*/
  80.